<?php

class My_Calendar_Day
{
    /**
     * @var Zend_Date
     */
    protected $date;
    /**
     * @var array 
     */
    protected $events;
    
    /**
     * @param Zend_Date $date
     * @param array $events 
     */
    public function __construct(Zend_Date $date, array $events)
    {
        $this->date = $date;
        $this->events = $events;
    }
    
    /**
     * @param Zend_Date|string $date
     * @param array $events
     * @return My_Calendar_Day 
     */
    public static function factory($date, $events = array())
    {
        if (!($date instanceof Zend_Date))
        {
            $date = new Zend_Date($date, Zend_Date::ISO_8601);
        }
        return new self($date, $events);
    }
    
    /**
     * @return Zend_Date
     */
    public function getDate($returnString = false)     
    {
        $date = $this->date;
        if (true == $returnString) $date = $date->get('Y-MM-dd');
        return $date;
    }

    /**
     * @return array
     */
    public function getEvents()
    {
        return $this->events;
    }
    
    /**
     * @return boolean 
     */
    public function hasEvents()
    {
        $hasEvents = false;
        if(count($this->getEvents())>0)
        {
            $hasEvents = true;
        }
        return $hasEvents;
    }


    
    
    
}